﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using FreshTexture.Settings;

namespace FreshTexture.Model
{
    /// <summary>
    ///     Klasa zajmująca się budowaniem Entity na podstawie danych zdepakowanych z zip-a
    /// </summary>
    internal static class CreateEntities
    {
        private static void CreateEntity(Dictionary<string, MemoryStream> slownik)
        {
            //todo metoda ma najpierw stworzyc IMyEntity puste z nazwami bloków a dopiero później wypełnić je wyszukanymi danymi. Jak nie znajdzie to w kodzie pozostanie obrazek defaultowy
        }

        public static List<Entity> CreateEmpty(List<Entity> destination, string collectionName)
        {
            var timer = new Stopwatch();
            timer.Start();
            var def = new Uri(@"DefaultImage\DefaultFace.png", UriKind.Relative);

            int max = MySettings.GetInt("MaxKnownEntities");

            for (int i = 0; i < max; i++)
            {
                destination.Add(new Entity
                {
                    Animated = false,
                    AnimationKeyFrames = null,
                    ArchiveName = null,
                    BlockName = StaticLists.BlocksName[i],
                    IsSelected = false,
                    FaceBack = def,
                    FaceBottom = def,
                    FaceFront = def,
                    FaceLeft = def,
                    FaceRight = def,
                    FaceTop = def,
                    IsSaved = true,    //ustawiamy na true. logika pozna wtedy , ze swierzyna
                    ModelType = null,
                    TxtFile = null
                });
            }
            timer.Stop();
            Debug.WriteLine("Created Empty Entities {0} at time (ms) {1} in {2} list", max, timer.ElapsedMilliseconds, collectionName);
            return destination;
        }
    }
}